<template>
  <el-main>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="提现申请日期">
        <el-date-picker
          v-model="value1"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="cztxApplyPage">查询</el-button>
      </el-form-item>
    </el-form>

  <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column
      prop="businessName"
      label="商户名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="applyAmount"
      label="提现金额"
      width="180">
    </el-table-column>
    <el-table-column
      prop="applyDate"
      label="申请日期"
      width="180">
    </el-table-column>
  </el-table>


    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="formInline.pageNum"
      :page-sizes="[1, 2, 5, 10]"
      :page-size="formInline.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>


  </el-main>
</template>

<script>
  import { cztxApplyPage,} from "@/api/finance/withdraw/index";

    export default {
        data(){
          return{
            tableData:[],
            formInline:{
              pageNum:1,
              pageSize:2,
              startDate:null,
              endDate:null
            },
            total:null,
            value1:[]
          }
        },
        methods:{
          cztxApplyPage(){
            if(this.value1.length>0){
              this.formInline.startDate = this.value1[0]
              this.formInline.endDate = this.value1[1]
            }
            cztxApplyPage(this.formInline).then(res=>{
              console.log(res)
              this.tableData = res.list;
              this.total = res.total;
            })
          },
          handleSizeChange(val) {
            this.formInline.pageSize = val
            this.formInline.pageNum = 1
            this.cztxApplyPage();
          },
          handleCurrentChange(val) {
            this.formInline.pageNum = val
            this.cztxApplyPage();
          }
        },
        created() {
          this.cztxApplyPage();
        }
    }
</script>

<style scoped>

</style>
